﻿using System.Configuration;
using AutoBuild.Core;

namespace AutoBuild.Console.CommandLine
{
    public class CommandLineAutoBuildArguments : AutoBuildArguments
    {
        public bool ShowHelp { get; set; }
		public bool Debug { get; set; }


        public void SetDefaultsFromAppConfig()
        {
            if (RunnerName.IsNullOrWhiteSpace())
            {
                var defaultRunner = ConfigurationManager.AppSettings["DefaultRunner"];
                if (defaultRunner.IsNullOrWhiteSpace())
                {
                    defaultRunner = Program.DefaultRunner;
                }
                RunnerName = defaultRunner;
            }
            if (WatchFolder.IsNullOrWhiteSpace())
            {
                var defaultWatchFolder = ConfigurationManager.AppSettings["DefaultWatchFolder"];
                if (defaultWatchFolder.IsNullOrWhiteSpace())
                {
                    defaultWatchFolder = Program.DefaultWatchFolder;
                }
                WatchFolder = defaultWatchFolder;
            }
        }
    }
}